//
//  GCDAsyncUdpSocketManager.h
//  GCDAsyncSocketManagerDemo
//
//  Created by 于鹏 on 2017/7/13.
//  Copyright © 2017年 于鹏. All rights reserved.
//

#import <Foundation/Foundation.h>
#define UDPSocketManager_instance [GCDAsyncUdpSocketManager udpShareInstance]

@protocol UDPAsyncSocketDelegate <NSObject>

@optional
/**
 *  监听到服务器发送过来的消息
 */
- (void)udpSocketReceiveData:(NSData *)data fromAddress:(NSData *)address;

@end

@interface GCDAsyncUdpSocketManager : NSObject
/**
 *tcp连接状态:1已连接, -1未连接, 0连接中
 */
@property (nonatomic, assign) NSInteger connectStatus;

/**
 socket 回调
 */
@property (nonatomic, weak) id<UDPAsyncSocketDelegate> udpSocketDelegate;
/**
 获取单例

 @return 单例对象
 */
+ (GCDAsyncUdpSocketManager *)udpShareInstance;
/**
 连接 socket
 
 @param delegate delegate
 */
//- (void)connectUdpSocketWithDelegate:(id)delegate;
- (void)connectUdpSocket;
/**
 发送数据

 @param sendData 发送的数据
 @param address 发送的地址
 */
- (void)updSocketSendData:(NSData *)sendData toAddress:(NSData *)address;

/**
 设置连接的端口

 @param port port
 */
//- (void)changePort:(NSInteger)port;
@end
